High speed bus with alignment, re-timing and buffer underflow/overflow detection enhancements

ABSTRACT

In a networked system in which high speed busses interconnect sources and destinations of data, systems for and methods of data alignment, data re-timing, and circular buffer underflow/overflow detection, are described. The invention is directed to a system for detecting either or both underflow and overflow of a circular buffer capable of holding n entries. The invention is also directed to a method of detecting either or both underflow and overflow of a circular buffer capable of holding n entries.

This application is a divisional application of U.S. application Ser.No. 10/405,961, filed Apr. 1, 2003, now U.S. Pat. No. 7,366,935; whichis incorporated herein by reference in its entirety.

FIELD OF THE INVENTION

This invention relates to the field of networked systems in which highspeed busses interconnect sources and destinations of data, and, morespecifically, to alignment, re-timing, and buffer underflow/overflowenhancements for such systems.

RELATED ART

In current network environments in which high speed busses interconnectsenders and receivers of data, the senders and receivers may be embodiedin various forms, including end user devices, such as PCs, intermediatedevices such as switches, routers, and gateways, or even asynchronousintegrated circuit chips (ASICs) situated within any of the foregoing.Such devices often operate substantially autonomously with respect toone another. Therefore, in the case in which the senders transmit datato various receivers around the networks, situations can arise in whichthe receivers are overwhelmed by the volume of data transmitted by thesenders. For example, a sender can transmit a block of data to areceiver which exceeds the amount of free storage which is available inone or more first-in-first-out (FIFO) buffers maintained by the receiverfor the purpose of buffering data received over the network.

To manage or avoid these situations, various mechanisms for flow controlhave emerged. According to a first mechanism, illustrated in FIG. 1, asender 102 transmits data 106 to a receiver 104. When the receiver 104is unable to accommodate additional data, it transmits a transmissionoff (XOFF) signal 108 to the sender 102, advising it to stoptransmitting data to the receiver 104. Responsive to the receipt of thissignal, the sender 102 ceases transmitting data to the receiver 104.When the receiver is able to accommodate additional data, itcommunicates a transmission on (XON) signal, also identified withnumeral 108, to the sender 102. Responsive to the receipt of thissignal, the sender 102 restarts transmitting data to the receiver 104.

A problem with this mechanism is that it generates an excessive amountof overhead, embodied in the form of successive XON and XOFF signals, inthe case in which the FIFO buffers used to buffer data at the receiversare relatively small. Therefore, other mechanisms for flow control haveemerged.

One such mechanism is illustrated in FIG. 2. There, a sender 202transmits a block of data 210 to the receiver 204. The sender 202maintains a counter 206 which is representative of the amount of freespace available in one or more FIFO buffers 208 maintained at thereceiver 204. When a FIFO buffer is initially freed up at the receiver204, the receiver sends an increment command 212 to the sender, over oneor more signal lines. Responsive thereto, the sender 202 increments thecounter 206 with the (known) size of the buffer. When the sender 202sends a block of data to the receiver 204, it checks the contents of thecounter 206 to determine if the one or more buffers 208 maintained atthe receiver 204 can accommodate the block of data. If the block of dataexceeds the contents of the counter 206, it is determined that the oneor more buffers maintained at the receiver 204 cannot accommodate theblock of data, and the sender 202 defers sending the data untiladditional buffer space is available. If the block of data is less thanor equal to the contents of the counter 206, it is determined that theone or more buffers maintained at the receiver can accommodate the blockof data. Hence, the sender 202 transmits the block of data to thereceiver, and decrements the counter 206 by the size of the block ofdata.

This approach reduces the amount of overhead signals transmitted betweenthe sender and receiver in the case in which small FIFO buffers aremaintained at the receiver. It also avoids latency in the time requiredfor the sender to determine the amount of free space at the receiver. Adrawback is that the sender and receiver can easily get out ofsynchronization with respect to the perceived amount of free space atthe receiver if, for example, an increment command sent to the sender islost, or if a block of data transmitted to the receiver is lost. Whenthis occurs, the error is catastrophic and cannot be recovered from.

Other problems occur when the data from the sender is sourcesynchronous. Source synchronous data must often be synchronized to aclock which is used to synchronize events at the receiver. This is adifficult task to achieve, particularly when multiple source synchronousstreams are concurrently being received at the receiver. Also, withsource synchronous data, it is difficult to accurately detect bufferoverflow/underflow conditions by comparing read and write pointers.

RELATED APPLICATION

This application is related to U.S. Pat. No. 7,272,672 entitled “HighSpeed Bus With Flow Control and Extended Burst Enhancements,” filed Apr.1, 2003, and owned in common by the assignee hereof, which is fullyincorporated by reference herein as though set forth in full.

SUMMARY

In a first aspect of this disclosure, a system is described for aligninga plurality of source synchronous streams of data. In this system, abuffer corresponding to each of the streams of data is provided. Inaddition, a status indicator corresponding to each of the streams ofdata is provided. This status indicator indicates whether or not datafor the corresponding stream has begun to be clocked into thecorresponding buffer.

First logic in the system clocks data from a stream into thecorresponding buffer using the source synchronous clock for the steam,and also sets the status indicator for the stream to indicate that datafor the stream has begun to be clocked into the corresponding buffer.

Meanwhile, second logic in the system checks the status indicators. Uponor after determining that data for all of the streams has begun to beclocked into the corresponding buffers, the second logic clocks data outof each of the buffers using a local clock common to all the buffers. Inone embodiment, the local clock is a master clock for the system.

In a second aspect of this disclosure, a system for re-timing a sourcesynchronous stream of data is described. In this system, first logicclocks data from the stream into a buffer using the source synchronousclock for the stream, and second logic clocks data out of the bufferusing a local clock. In one embodiment, the local clock is a masterclock for providing overall synchronization of the system or a networkedsystem of which the re-timing system is a part.

In a third aspect of this disclosure, a system is described fordetecting either or both underflow and overflow conditions of a circularbuffer capable of holding n entries, wherein n is an integer of two ormore. In this system, each entry in the buffer includes a tag portion.

A first counter is provided which circularly counts through m values,wherein m is an integer which is less than n and not evenly divisibleinto n. First logic performs a read operation by (1) reading an entryfrom the buffer, (2) comparing the tag portion of the entry with thecontents of the counter, and (3) either or both (a) signaling anunderflow condition if the tag portion of the entry is less than thecontents of the counter, and (b) signaling an overflow condition if thecontents of the tag portion of the entry exceed the contents of thecounter. If the contents of the counter equal the tag portion of theentry, the contents of the first counter are updated to reflect the readoperation.

Other systems, methods, features and advantages of the invention orcombinations of the foregoing will be or will become apparent to onewith skill in the art upon examination of the following figures anddetailed description. It is intended that all such additional systems,methods, features, advantages and combinations be included within thisdescription, be within the scope of the invention, and be protected bythe accompanying claims.

BRIEF DESCRIPTION OF THE DRAWINGS

The components in the figures are not necessarily to scale, emphasisinstead being placed upon illustrating the principles of the invention.In the figures, like reference numerals designate corresponding partsthroughout the different views.

FIG. 1 is a block diagram illustrating a conventional transmiton/transmit off method of flow control.

FIG. 2 is a block diagram illustrating a conventional counter-basedmethod of flow control.

FIG. 3 is a block diagram illustrating a counter-based method of flowcontrol in which the counter may be updated based on incremental orabsolute free storage available at the receiver.

FIG. 4 is a block diagram illustrating both source synchronous andmaster clock domains.

FIG. 5 is a timing diagram illustrating the clocking of commands over aplurality of signal lines synchronized to a double data recovery (DDR)source synchronous clock.

FIG. 6 is a block diagram illustrating the generation of multiple sourcesynchronous data streams at a sender.

FIG. 7A is a block diagram illustrating a multi-buffer arrangement foraligning multiple source synchronous data streams, and synchronizing theread out of the same to a master clock common to all the streams.

FIG. 7B illustrates an example of a multi-stream status indicator foruse in the system of FIG. 7A.

FIG. 8 is a block diagram of a system for re-timing a source synchronousdata stream from the source synchronous domain to the master clockdomain.

FIG. 9 is a block diagram illustrating extended burst transfers.

FIG. 10A is a block diagram illustrating an example of a write operationto a circular buffer which does not result in an overflow condition.

FIG. 10B is a block diagram illustrating an example of a write operationto a circular buffer which results in an overflow condition.

FIG. 10C is a block diagram illustrating the state of the circularbuffer just prior to the read operation of FIG. 10D.

FIG. 10D is a block diagram illustrated an example of a read operationwhich results in an underflow condition.

FIG. 11 is a flowchart of a method of performing flow control between asender and receiver in a networked system.

FIG. 12A is a flowchart of a method of aligning multiple sourcesynchronous data streams.

FIG. 12B is a snapshot of the buffers in an example of the alignmentsystem of FIG. 7A upon or after a determination that the statusindicators for all the buffers are set.

FIG. 13 is a flowchart of a method of re-timing a source synchronousdata stream.

FIG. 14 is a flowchart of a method extending a burst transfer.

FIG. 15 is a flowchart of a counter-based method of detecting either orboth underflow and overflow conditions in a circular buffer.

DETAILED DESCRIPTION

As utilized herein, terms such as “about” and “substantially” and “near”are intended to allow some leeway in mathematical exactness to accountfor tolerances that are acceptable in the trade. Accordingly, anydeviations upward or downward from the value modified by the terms“about” or “substantially” or “near” in the range of 1% to 20% should beconsidered to be explicitly within the scope of the stated value.

As used herein, the term “software” includes source code, assemblylanguage code, binary code, firmware, macro-instructions,micro-instructions, or the like, or any combination of two or more ofthe foregoing.

The term “memory” refers to any processor-readable medium, including butnot limited to RAM, ROM, EPROM, PROM, EEPROM, disk, floppy disk, harddisk, CD-ROM, DVD, or the like, or any combination of two or more of theforegoing, on which may be stored a series of software instructionsexecutable by a processor.

The terms “processor” or “CPU” refer to any device capable of executinga series of instructions and includes, without limitation, a general- orspecial-purpose microprocessor, finite state machine, controller,computer, digital signal processor (DSP), or the like.

The term “logic” refers to implementations in hardware, software, orcombinations of hardware and software.

The term “counter” means (1) a device such as a register or storagelocation used to represent the number of occurrences of an event, or (2)an instrument for storing integers, permitting these integers to beincreased or decreased sequentially by unity or by an arbitrary integer,and capable of being reset to zero or to an arbitrary integer, or (3) adevice with a finite number of states each of which represents a numberwhich, upon receipt of an appropriate signal, can be incremented ordecremented by a given constant, and which may be capable of being setto a particular state such as zero, or (4) a register or storagelocation used to accumulate the number of occurrences of some event.Examples include a modulo-n counter, or a reversible counter.

The term “receiver” means any recipient of data in a bussed or networkedsystem.

FIG. 3 illustrates a system 300 for performing flow control between asender 302 and receiver 304 of data interconnected by one or more busses310, 312, 314 in a networked system. In this system, a counter 306 ismaintained at the sender 302, and the contents thereof, afterinitialization, are representative of free space available at thereceiver 304 through one of more buffers 308.

The sender 302 is normally in a first default state. While in thisstate, the sender, when it is desired to transmit a block of data to thereceiver 304, first compares the size of the block with the contents ofthe counter 306. If the size of the block exceeds the available freespace at the receiver 304, the sender 302 defers or avoids transmittingthe block. If the size of the block equals or is less than the availablefree space at the receiver 304, the sender 302 transmits the block overone or more signal lines 310, and the receiver 304, upon receiving thedata, stores it in the one or more buffers 308. Upon or aftertransmission of a block to the receiver 304, first logic at the sender302 decrements the counter 306 by the size of the block.

When free space in one or more buffers 308 becomes available, thereceiver 304 sends a first command, INCREMENT n, to the sender advisingit of the same. In FIG. 3, this command is transmitted over one or moresignal lines 312. The argument n of the command is an integerrepresentative of the incremental amount of free space which has becomeavailable at the receiver 304. In response to the sender's receipt ofthis command, second logic at the sender 302 increments the counter 306by the argument n, i.e., the amount of incremental free space which hasbecome available in the one or more buffers 308 maintained at thereceiver 304.

From time to time, the receiver 304 may also send a second command,ABSOLUTE m, to the sender, advising it of the amount of absolute freespace which is available in one or more buffers maintained at thereceiver 304. In FIG. 3, this command is sent over or more signal lines314 (which may be the same as or different from signal lines 312). Inresponse, third logic at the sender stores a value representative ofthis absolute free space in the counter 306. Through this third command,synchronization between the contents of the counter 306 and the absoluteamount of free space at the receiver 304 can be easily maintained.Moreover, unlike the conventional flow control system illustrated inFIG. 2, in the system illustrated in FIG. 3, error recovery is nowpossible if it is ever determined that the contents of the counter 306are not representative of the amount of free space actually available atthe receiver 304.

In one implementation, upon reset or initialization, the sender 302enters a third reset state, and the contents of the counter 306 areinitialized to zero. An ABSOLUTE m command, upon receipt thereof by thesender 302, transitions the sender 302 to the first state, and alsoinitializes the counter 306 with the amount of absolute free spaceavailable at the receiver 304.

In one implementation example, a lock out counter is maintained at thesender 302 to avoid race conditions where data is transmitted from thesender 302, and an ABSOLUTE m command is sent from the receiver 304prior to its receipt of the data due to the latency of the bus. Sincethe ABSOLUTE m command is sent prior to receipt of the data at thereceiver 304, it overstates the absolute free space available at thereceiver 304.

Upon being reset, the lockout counter is configured to automaticallycount up to a predetermined number of clock pulses, e.g., 255, and thenstop. The counter is reset when the sender 302 transmits data to thereceiver 304. Any ABSOLUTE m command received while the counter iscounting up to its final state is ignored. When the counter reaches itsfinal state, it stops counting. Any ABSOLUTE m command received whilethe counter is in this state is executed. Other approaches forimplementing this lock-out feature are possible so nothing in theforegoing should be taken as limiting.

In one embodiment, the system 300 further comprises fifth logic in thesender 302 for transitioning the sender 302 to a second state upon orafter receipt of a third command from the receiver. In one example, thisthird command may be referred to as the BLACK HOLE command. This secondstate is characterized by the sender 302 transmitting data to thereceiver 304 without regard to the contents of the counter 306.

In a second embodiment, the system 300 further comprises sixth logic inthe sender 302 for transitioning the sender 302 from the second state tothe first state upon or after receipt of the second command, i.e., theABSOLUTE m command, from the receiver 304.

In one example, the sender 302 and receiver 304 are ASICs, and the oneor more buffers 308 are first-in-first-out (FIFO) buffers. In oneimplementation, the system 300 is embodied in the sender 302.

FIG. 4 illustrates a networked system 400 in which source synchronousdata is transmitted from a sender 402 to a receiver 404. The sourcesynchronous data comprises a data portion, which is transmitted over oneor more signal lines 410, and a clock portion, which is transmitted overone or more signal lines 412. At the receiver 404, the data portion issampled using the clock portion. Since the data and clock portions areequally affected by latency in the system, there is little risk ofmisalignment between the data and clock portions. In one implementation,the clock portion comprises a double data rate (DDR) clock in which thedata portion is sampled on both the rising and falling edges of theclock.

Turning back to FIG. 3, the commands INCREMENT n, ABSOLUTE m, or BLACKHOLE, as previously discussed, may be transmitted from receiver 304 tosender 302 in the form of source synchronous signals. In one example,each of these commands may be communicated to the sender 302 over threesignal lines. In FIG. 5, the first signal line, identified with numeral502, carries the source clock. In the particular example illustrated,the source clock is a DDR clock, which means that data is carried on theother two signals at both positive-going and negative-going transitionsof the clock. The second signal line, identified with numeral 504,carries four bits, CMD3, CMD2, CMD1, and CMD0, specifying the commandtype, and four bits, PORT3, PORT2, PORT1, and PORT0, specifying one ofsixteen ports at the receiver that the command relates to. It is assumedin this example that the senders and receivers each have 16 ports, and acommunication between the two can take place using any of the 16 ports.It is also assumed in this example that a value of 0x8 for the fourcommand bits, CMD[3:0] specifies the INCREMENT command, a value of 0xC(hex) for these bits specifies an ABSOLUTE command, and a value of 0xE(hex) for these bits specifies a BLACK HOLE command. The third signalline, identified with numeral 506, carries eight bits, DATA7, DATA6,DATA5, DATA4, DATA3, DATA2, DATA1, and DATA0. These eight bits specifythe argument, i.e., n or m, of the command. With these 8 bits, anINCREMENT or ABSOLUTE command specifying up to 256 bytes of incrementalor absolute free space may be communicated to the sender.

FIG. 6 illustrates a particular configuration of a sender in which asingle stream of data 606 emanating from a media access controller (MAC)602 is split up (for pin conservation purposes) into a plurality ofseparate source synchronous streams 616 a, 616 b, 616 c and 616 d. Theprocess of splitting up the stream 606 into separate streams, andassociating each of the streams with its own separate clock, isperformed by corresponding data path elements 614 a, 614 b, 614 c and614 d under the control of controller 610, which in turn is directed bythe MAC 602 through control line 608. These separate source synchronousstreams are then transmitted to a receiver.

The situation is depicted in FIG. 4, which shows a source synchronousstream 410, 412 transmitted from the sender 402 to the receiver 404.(For ease of illustration only, one source synchronous stream isillustrated in FIG. 4, it being understood that for purposes of thisdiscussion multiple such streams may be present). A master clock 414 iscommon to both the sender 402 and receiver 404. When the multiplestreams are received at the receiver 404, there is a need to combine andalign the data so it is synchronous with the master clock.

FIG. 7A illustrates a system for performing this function which may beembodied at the receiver. The data portions of the incoming streams areidentified with numerals 708 a, 708 b, 708 c, 708 d, and 708 e, and theclock portions of the incoming streams are identified with numerals 710a, 710 b, 710 c, 710 d, and 710 e. A buffer 702 a, 702 b, 702 c, 702 d,and 702 e for each of the incoming streams is provided. In addition, astatus indicator (not shown in FIG. 7A) corresponding to each of thestreams of data is provided. This status indicator indicates whether ornot data for the corresponding stream has begun to be clocked into thecorresponding buffer. An example of such a status indicator, implementedas a multi-bit storage location, with a bit allocated for each of thestreams, is illustrated in FIG. 7B. The individual bits in the exampleillustrated are identified with numerals 716 a, 716 b, 716 c, 716 d, and716 e. The default state of each these bits may be ‘0’, and when datafor a stream has begun to be clocked into a buffer, the correspondingbit is set to a ‘1’.

First logic in the system clocks data from a stream into thecorresponding buffer using the source synchronous clock for the steam,and also sets the status indicator for the stream to indicate that datafor the stream has begun to be clocked into the corresponding buffer.

Meanwhile, second logic in the system, embodied as state machine (SM)704 and alignment logic 706 in the particular implementation illustratedin FIG. 7B, checks the status indicators. Upon or after determining thatdata for all of the streams has begun to be clocked into thecorresponding buffers, the second logic clocks this data out of each ofthe buffers using a master clock 714 common to all the buffers to form acombined stream 712 which is synchronized to the master clock 714.

In one embodiment of this system, the buffers 702 a, 702 b, 702 c, 702d, and 702 e are FIFO buffers, and the source synchronous clocks 710 a,710 b, 710 c, 710 d and 710 e for each of the streams are double datarate (DDR) source synchronous clocks.

In one implementation, each of the FIFO buffers 702 a, 702 b, 702 c, 702d, and 702 e has a write pointer. Moreover, a single read pointer isprovided which is common to all the buffers. In this implementation, thefirst logic is configured to update the write pointer for a buffer asdata for a stream is clocked into the buffer using the sourcesynchronous clock for the stream, and the second logic is configured toupdate the read pointer common to all the buffers as data is clocked outof the buffers using the master clock. In one example, the first logicupdates the write pointer for a buffer during a write operation byincrementing it, and the second logic updates the read pointer during aread operation as data is clocked out the buffers by incrementing it.Alternatively, the first logic may update the write pointer for a bufferduring a write operation by decrementing it, and the second logic mayupdate the read pointer during a read operation by decrementing it.

Turning back to FIG. 4, as stated, a master clock 404 is common to boththe sender 402 and receiver 404. When even a single stream of sourcesynchronous data is received at the receiver 404, there is often a needto re-time the data so it is synchronous with the master clock (or otherlocal clock) rather than the source synchronous clock. Accordingly, thesystem 800 illustrated in FIG. 8, which may be embodied in the receiver404, is provided for performing this function.

In this system, first logic clocks the data portion 804 of the streaminto buffer 802 using the clock portion 806 of the source synchronousstream. After a time, second logic clocks the data out of the buffer 802using the master clock 808 (or other local clock). The data as it isclocked out of the buffer is identified in FIG. 8 with numeral 810.

In one embodiment, the clock portion of the stream is a DDR sourcesynchronous clock, and the buffer 802 is a FIFO buffer. In oneimplementation, the FIFO buffer has a read pointer and a write pointer,and the first logic is configured to update the write pointer during awrite operation using the source synchronous clock 806 for the stream,and the second logic is configured to update the read pointer during aread operation using the master clock 808. In one example, the writepointer is updated during a write operation by incrementing it, and theread pointer is updated during a read operation by incrementing it.Alternatively, the write and read pointers may both be decrementedduring their respective operations.

Turning back to FIG. 4, it is often convenient to transfer data from thesender 402 to the receiver 404 in the form of bursts of predeterminedsize. In one example, in which commands, such as the INCREMENT n,ABSOLUTE m, or BLACKHOLE, may also be transmitted from the sender 402 tothe receiver 404 in the form of four clock cycle/eight clock transitionbursts as illustrated in FIG. 5, it is convenient to set the possiblepredetermined sizes of the data bursts to integer or fractionalmultiples of the burst size needed to transmit the commands. In oneexample, the possible predetermined sizes of the data bursts are 32, 48,64, and 80 bytes. In this particular example, the initiation of acommand burst can be determined by examining the STAT C signal line 504illustrated in FIG. 5. A 0 to 1 transition on that signal line,consistent with 0x8, 0xC (hex), or 0xE (hex) values for CMD[3:0],indicates the initiation of a command burst.

When the data is transmitted in the form of bursts, however, the issueof fractional bursts, a burst less than one or more of the possible,normally-used burst sizes, must be dealt with. This problem isparticularly acute in the case in which the possible burst sizes areexpressed in the form of a plurality of discrete, predetermined burstsizes. In many cases, the size of the fractional burst may not besufficient to justify the overhead needed to transfer the burst.

A system 900 which addresses this problem is illustrated in FIG. 9. Inthis system, data is transmitted over bus 906 in the form of bursts. Thesystem 900 selectively varies the number of bursts used to transfer ablock of data in order to overcome the problem of excessive overheadassociated with small sized fractional bursts.

In this system, first logic transmits a block of data as n bursts(wherein n is an integer of two or more) provided the size of anyfractional burst in the n bursts exceeds a threshold level.

However, second logic transmits the block as less than n burstsif thesize of any fractional burst is less than or equal to the thresholdlevel.

In one embodiment, a block of data which would otherwise be representedas n bursts of one or more predetermined sizes, where the nth burst is afractional burst having a size less than or equal to the thresholdlevel, is in fact transmitted as n−1 bursts, where the first n−2 burstsare of a first predetermined size, and one of the bursts, normally butnot necessarily the last, (n−1)st burst, is of a second predeterminedextended size, equal to the sum of the first predetermined size and anamount sufficient to accommodate the size of the fractional burst. Sincethe block is transmitted as n−1 bursts, the overhead associated with thenth burst is avoided.

In one implementation, as illustrated in FIG. 9, the sender 902indicates to the receiver 904 through a signal line 910 that an extendedburst is being is being transmitted, and also indicates to the receiver904 the size of the current burst being sent over one or more signallines 908. Upon receipt of this information, the receiver 904 is able totake appropriate action to buffer or otherwise handle the burst.

In one example, the first predetermined burst size is 64 bytes, thesecond predetermined extended burst size is 80 bytes, and the thresholdlevel is 16 bytes. If a fractional burst is less than or equal to 16bytes in size, the block is transmitted as n−1 bursts, with n−2 burstsbeing of the first predetermined size of 64 bytes, and the (n−1)th bursthaving the second predetermined extended size of 80 bytes. If, on theother hand, the fractional burst is greater than 16 bytes in size, theblock is transmitted as n bursts, with n−1 bursts being of the firstpredetermined size of 64 bytes in size, and the nth burst having apredetermined size equal to 32, 48 or 64 bytes, whichever is needed toaccommodate the size of the fractional burst as a standalone entity. Inthis example, the sender 902 communicates to the receiver 904 the sizeof a burst using a 6 bit value, which is capable of indicating absolutesizes of up to 64 bytes. When the extended burst indicator is asserted,the 6 bit value which is transmitted is the absolute size of the burstminus 64. Through this approach, the 6 bits can be used to communicateburst sizes of up to 80 bytes. Thus, for a burst size of 80 bytes, thesender 902 in this example communicates a value of 16 to the receiver904 using these 6 bits.

Turning back to FIG. 8, the traditional method of detecting underflow oroverflow for the buffer 802 is based on a comparison of read and writepointers. However, in the system 800 of FIG. 800, since the writepointer for the buffer 802 is typically updated through the sourcesynchronous clock 806, and the read pointer for this buffer is typicallyupdated through a different clock, the master clock 808, the traditionalmethod will not always be accurate in detecting underflow or overflowconditions. Instead, race conditions can cause the traditional method todetect underflow or overflow conditions when none exist, or fail todetect underflow or overflow conditions when such are in fact present.

To avoid this problem, a counter-based system for detecting either orboth underflow and overflow conditions of a circular buffer such as aFIFO buffer is provided. In this system, which is illustrated throughthe examples of FIGS. 10A and 10B, the buffer 1000 is assumed to becapable of holding n entries, wherein n is an integer of two or more.Moreover, each entry in the buffer includes a tag portion 1002.

A first counter 1008 is provided which is capable of circularly countingthrough m values, wherein m is an integer which is less than n and notevenly divisible into n.

First logic performs a read operation from the buffer 1000 by (1)reading an entry from the buffer, (2) comparing the tag portion 1002 ofthe entry with the contents of the counter 1008, and (3) either or both(a) signaling an underflow condition if the tag portion 1002 of theentry is less than the contents of the counter 1008, and (b) signalingan overflow condition if the tag portion 1002 of the entry exceeds thecontents of the counter 1008. If the contents of the counter 1008 equalthe tag portion 1002 of the entry, the contents of the first counter1008 are updated.

In one embodiment, the system further comprises a second counter 1010for circularly counting through m values. In this second embodiment,second logic performs a write operation by (1) forming an entry to bewritten to the buffer, the tag portion 1002 of the entry representativeof the contents of the second counter 1010, (2) writing the entry to thebuffer, and (3) updating the contents of the second counter.

In one implementation, the first logic is configured to update thecontents of the first counter 1008 during a read operation byincrementing it, and the second logic is configured to update thecontents of the second counter 1010 during a write operation byincrementing it.

In an alternate implementation, the first logic is configured to updatethe contents of the first counter 1008 during a read operation bydecrementing it, and the second logic is configured to update thecontents of the second counter 1010 during a write operation bydecrementing it.

To further explain the operation of this system, consider the exampleillustrated in FIG. 10A. In this example, circular buffer 1000 isassumed to be a FIFO buffer with five possible entries, and read counter1008 and write counter 1010 are configured to circularly count between 0and 2 in increments of 1. In other words, the pattern of values achievedby the counters follow a repeating pattern as follows: 0, 1, 2, 0, 1, 2,0, 1, 2, etc. Three entries are assumed to have been written into thebuffer 1000, bearing respectively tag values of 0, 1, and 2. The writepointer 1006 points to the next available entry in the buffer 1000 forwriting to, and the read pointer 1010 points to the next entry in thebuffer 1000 to be read from.

When a read operation is performed, the tag value of the entry pointedto by the read pointer is compared with the contents of the read counter1008. Since the two agree, an overflow condition is not detected.Instead, the value is read, and the read pointer and read counter areboth incremented.

When a write operation is performed, the contents of the write counter1010 becomes the tag value for the entry written into the buffer 1000 atthe location pointed to by the write pointer 1006. Then, both the writepointer and write counter are both incremented.

Now, consider the example illustrated in FIG. 10B. This examplerepresents that illustrated in FIG. 10A after four additional successivewrite operations to the buffer 1000. At the conclusion of these writeoperations, the tag portions of the buffer entries, the contents of theread and write counters 1008, 1010, and the locations pointer to by theread and write pointers 1002, 1004 are as illustrated in FIG. 10B.

When the next read operation is performed, the tag value for thelocation pointed to by the read pointer 1002, 2, is compared with thecontents, 0, of the read counter 1008, an overflow condition is detectedsince the tag value for the entry exceeds the contents of the readpointer 1002. That is an accurate assessment of the situation since, ascan be seen from FIG. 10B, two valid entries in the buffer have beenoverwritten: that pointed to by the read pointer, and the nextsuccessive location.

FIG. 10C illustrates the state of buffer 1000 of FIG. 10A after two morewrite operations, followed by two additional read operations. FIG. 10Dillustrates the buffer of FIG. 10C after three more read operations.During the third of these operations, the tag portion of the entry 1014,0, is compared with the contents of the read counter 1008, 2. Since thetag portion of the entry 1014 is less than the contents of the readcounter 1008, an underflow condition is detected. That is an accurateassessment of the situation since, as illustrated in FIG. 10D, the entry1014 has been re-read even though this value has already been read and anew data value has not yet been written into this entry.

FIG. 11 is a flowchart of one embodiment of a method 1100 of performingflow control between a sender and receiver of data in a networkedsystem. In this method, the sender is configured to maintain a counterwhose contents, after initialization, are representative of availablefree space in one or more buffers maintained by the receiver. Asillustrated, in one embodiment, upon the inception of the method,program control or method flow may pass down one of three branches,identified respectively with numerals 1102, 1114, and 1118. Each one ofthese three branches will be explained in turn.

Branch 1102 is followed if it is desired to transmit a block of datafrom the sender to the receiver. Inquiry step 1104 is performed, toinquire whether the sender is in a first (default) state indicating thatthe contents of the counter should first be checked before performingthe transfer. If so, inquiry step 1106 is performed. In inquiry step1106, it is determined whether or not the size of the block to betransmitted is less than or equal to the contents of the counter. If so,step 1108 is performed. In step 1108, the block of data is transmittedto the receiver. Then, step 1110 is performed. In step 1110, thecontents of the counter are decremented by the size of the block.Program control or method flow is then exited or terminated.

If, in inquiry step 1106, it is determined that the size of the block tobe transmitted exceeds the contents of the counter, step 1107 isperformed. In step 1107, transmission of the block is either deferred oravoided. Program control or method flow is then exited or terminated.

Turning back to inquiry step 1104, if it is determined that the senderis not in the first state, program control or method flow is exited orterminated. Alternatively, in one embodiment, it is assumed that thesender is in a second state, characterized by the fact that data istransmitted by the sender to the receiver without regard to the contentsof the counter. (Instead of assuming that the sender is in the secondstate, an inquiry step could be performed here to ensure that the senderis in the second state. If not, an error condition could be flagged.).Step 1112 is then performed. In step 1112, the block of data istransmitted to the receiver, while avoiding the inquiry step 1106.Program control or method flow is then exited or terminated.

Branch 1114 is followed if a first command is received advising thesender of the amount of incremental free space which has becomeavailable at the receiver. In one embodiment, as discussed, this firstcommand is of the form INCREMENT n, where n indicates the incrementalfree space which has become available at the receiver. In step 1116,upon or after receipt of such a command at the sender, the counter isincremented by n, the incremental free space which has become availableat the receiver. Program control or method flow is then exited orterminated.

Branch 1118 is followed if a second command is received advising thesender of the absolute amount of free space which is available at thereceiver. In one embodiment, as discussed, this command is of the formABSOLUTE m, where m is the absolute amount of free space available atthe sender. Upon or after receipt of such a command at the sender, step1120 is performed. In step 1120, the value m, the absolute amount offree space available at the sender, is stored in the counter.

In one embodiment of branch 1118, a check is made whether the sender isin the third reset state. If so, in addition to storing the value m inthe counter in step 1120, the sender is transitioned into the firststate.

In one implementation of branch 1118, a check is also made whether thelock-out timer (previously discussed) is still counting up to its finalstate. If so, the ABSOLUTE m command is ignored. If not, the ABSOLUTE mcommand is implemented.

Program control or method flow is then exited or terminated.Alternatively, in one embodiment, inquiry step 1122 is performed. Ininquiry step 1122, it is determined whether or not the sender is in thesecond state which, as discussed earlier, is characterized by the factthat transmission occurs without regard to the contents of the counter.If the sender is in the second state, step 1124 is performed. In step1124, the sender is transitioned from the second state to the firststate which, as discussed previously, is characterized by the fact thatthe contents of the counter are compared with the size of a block beforethat block is transmitted to the receiver. Program control or methodflow then exits or terminates.

In inquiry step 1122, if it is determined that the sender is not in thesecond state, it is assumed that the sender is already in the firststate, and program control or method flow exits or terminates.Alternatively, an inquiry step could be performed here to explicitlydetermine whether or not the sender is in the first state. If not, anerror condition could be flagged.

In one embodiment, another branch is followed upon or after receipt of athird command directing the sender to transmit data without regard tothe contents of the counter. As discussed previously, this command maytake the form of BLACK HOLE. In this embodiment, upon or after receiptof such a command, the sender is transitioned to the second state.

FIG. 12 is a flowchart of a method 1200 of aligning a plurality ofsource synchronous streams of data. In one embodiment, the method beginswith step 1202, which comprises having the sender enter an alignmentmode, and transmit a predetermined pattern of data through the multiplestreams at the same time. In the configuration illustrated in FIG. 6,this step is performed by controller 610 arranging to have each of theDPs 614 a, 614 b, 614 c, 614 d, and 614 d transmit the predeterminedpattern, in source synchronous format, at the same time.

Turning back to FIG. 12, step 1204 is then performed. In step 1204, thedata from each of the streams is clocked into a corresponding bufferusing the source synchronous clock for the stream. Step 1206 is thenperformed. In step 1206, a status indicator for the stream is set toindicate that data for the stream has begun to be clocked into thecorresponding buffer.

Inquiry step 1208 is also performed. Although this step is shown in FIG.12 as being performed after steps 1202-1206, it may be performedconcurrently with these steps. In inquiry step 1208, the statusindicators are checked. If it is determined that the status indicatorsfor all the buffers indicate that data for all of the streams has begunto be clocked into the corresponding buffers, step 1210 is performed. Instep 1210, data from each of the buffers is clocked out using a masterclock common to all the buffers. At this point, since alignment has beenachieved, in one embodiment, the sender exits the alignment mode ofoperation, and enters a normal mode of operation.

In one implementation of this method, the source synchronous clocks aredouble data rate (DDR) source synchronous clocks, and the buffers areeach FIFO buffers.

In one implementation example, each of the buffers are FIFO buffershaving a separate write pointer, and there is also a read pointer iscommon to all the buffers. In this implementation example, the writepointer for a buffer is updated as data for the stream is clocked intothe buffer using the source synchronous clock for the stream, and theread pointer common to all the buffers is updated as data is clocked outof the buffers using the master clock.

The step of updating the write pointer for a buffer may compriseincrementing the pointer for each entry written into the buffer, and thestep of updating the read pointer may comprise decrementing the pointerfor each group of entries read out in common from the buffers.Alternatively, the step of updating the write pointer may comprisedecrementing it for each entry written into the buffer, and the step ofupdating the read pointer may comprise incrementing it for each group ofentries read out in common from the buffers.

An example of the process of updating the write pointers and the commonread pointer is illustrated in FIG. 12B. In this example, it is assumedthat there are three streams of incoming data, and hence three separatebuffers, identified respectively with numerals 1212 a, 1212 b, and 1212c. It is also assumed that the write pointers for each of the buffers,and the common read pointer, were each initialized to point to the firstentry in each of the buffers, identified respectively with numerals 1216a, 1216 b, and 1216 c. It is further assumed that FIG. 12B provides asnapshot of the state of affairs in this arrangement upon determiningthat the status indicators for each of the buffers have all been set.

At this point, it is assumed that four entries have been written intobuffer 1212 a, one entry has been written into buffers 1212 b, and threeentries have been written into buffer 1212 c. Hence, the write pointerfor buffer 1212 a, identified with numeral 1214 a, points to the fifthentry from the top in buffer 1212 a; the write pointer for buffer 1212b, identified with numeral 1214 b, points to the second entry from thetop in buffer 1212 b; and the write pointer for buffer 1212 c,identified with numeral 1214 c, points to the fourth entry from the topin buffer 1212 c.

Since the status indicators for each of the buffers has been set, theprocess of reading out groups of entries common to all the buffers maycommence, starting with the first entry in each buffer, i.e., entries1216 a, 1216 b, and 1216 c, since that is the location pointed to by theread pointer.

FIG. 13 is a flowchart of a method 1300 of re-timing a sourcesynchronous stream of data. The method commences with step 1302, whichcomprises clocking data from the stream into a buffer using the sourcesynchronous clock for the stream. Step 1302 is followed by step 1304,which comprises clocking data out of the buffer using a local clock.From step 1304, the method may then jump back to step 1302 foradditional iterations.

In one embodiment, the method occurs in a networked system. In oneimplementation, the local clock is a master clock for the networkedsystem, such as clock 414 in FIG. 4. In one example, the sourcesynchronous clock is a DDR source synchronous clock, and the buffer is aFIFO buffer.

The FIFO buffer may have a read pointer and a write pointer. If so, thewrite pointer is updated as data is clocked into the buffer using thesource synchronous clock, and the read pointer is also updated as datais clocked out of the buffer using the local clock.

The step of updating the write pointer may comprise incrementing thewrite pointer for each entry written into the buffer, and the step ofupdating the read pointer may comprise incrementing the read pointer foreach entry read from the buffer.

Alternatively, the step of updating the write pointer may comprisedecrementing the write pointer for each entry written into the buffer,and the step of updating the read pointer may comprise decrementing theread pointer for each entry read from the buffer.

FIG. 14 is a flowchart of a method 1400 of selectively varying thenumber of burst transfers used to transmit a block of data. It isassumed that a block of data is desired to be transmitted from a senderto a receiver in a networked system, and it has been determined that theblock is such as to require n bursts, where n is an integer of two ormore, and that at least one of the bursts is a fractional burst, i.e., aburst in which the amount of data to be transmitted by the burst is lessthan one or more of the possible, normally-used sizes (or capacities) ofa burst.

The method begins with inquiry step 1402. In inquiry step 1402, it isdetermined whether the size of the factional burst exceeds a thresholdlevel. If so, step 1404 is performed. If not, step 1406 is performed.

In step 1404, the block of data is transmitted as n bursts. In step1406, the block of data is transmitted as less than n bursts. Programcontrol or method flow then terminates or exits.

In one embodiment, step 1406 comprises transmitting the block of data asn−1 bursts comprising n−2 bursts of a first predetermined size, and oneburst having a second predetermined extended size equal to the firstpredetermined size plus an amount sufficient to accommodate the size ofthe fractional burst. In one implementation, data representative of thesize of each of the bursts is also transmitted, as well as an indicatorof whether the burst is of the second extended size.

In one example, the first predetermined burst size is 64 bytes, thesecond predetermined extended burst size is 80 bytes, and the thresholdlevel is 16 bytes. In this example, step 1404 comprises transmitting theblock as n bursts comprising (n−1) 64 byte bursts, and one burst havinga predetermined size of either 32, 48, or 64 bytes, whichever is neededto accommodate the fractional burst as a standalone burst. Step 1406comprises transmitting the block as (n−1) bursts comprising (n−2) 64byte bursts, and one burst having a predetermined extended burst size of80 bytes.

FIG. 15 is a flowchart of a method 1500 of detecting either or bothunderflow and overflow conditions of a circular buffer capable ofholding n entries, wherein n is an integer of two or more, in which eachentry of the buffer includes a tag portion.

In one embodiment, the method is incidental to the performance of a readoperation from the buffer. In this embodiment, the method begins withstep 1502, which comprises reading an entry from the buffer.

From step 1502, the method proceeds to step 1504, which comprisescomparing the tag portion of the entry with the contents of a firstcounter configured to circularly count up to m values, where m is aninteger less than n and not evenly divisible into n.

Inquiry step 1506 follows step 1504. In inquiry step 1506, it isdetermined whether the tag portion of the entry agrees with the contentsof the first counter. If so, step 1508 is performed. If not, step 1510is performed followed by step 1508.

Step 1508 comprises updating the contents of the first counter toreflect the read operation. Step 1510 comprises performing either orboth of the following steps: (a) signaling an underflow condition if thetag value of the entry is less than the contents of the first counter,and (b) signaling an overflow condition if the tag portion of the entryis greater than the contents of the first counter.

From step 1508, program control or method flow exits or terminates.

In one embodiment, the method 1500 further comprises performing a writeoperation. In one embodiment, the process of performing a writeoperation comprises forming an entry to be written to the buffer, thetag portion of the entry representative of the contents of a secondcounter configured to circularly count up to m entries; writing theentry to the buffer; and updating the contents of the second counter.

In one implementation, the step of updating the contents of the firstcounter during a read operation comprises incrementing it, and the stepof updating the contents of the second counter during a write operationcomprises incrementing it.

In another implementation, the step of updating the contents of thefirst counter during a read operation comprises decrementing it, and thestep of updating the contents of the second counter during a writeoperation comprises decrementing it.

In one implementation example, the circular buffer is a FIFO buffer.

The methods of FIGS. 11-15, and any of the embodiments, implementationsand examples which have been discussed, may be implemented throughsoftware, hardware, or any combination of hardware and software. Inrelation to the software implementation, the methods may be embodied inthe form of software instructions stored in a memory. Furthermore, thismemory may be accessible by a processor in a system, wherein theprocessor is configured to successively retrieve and execute thesoftware instructions.

While various embodiments of the invention have been described, it willbe apparent to those of ordinary skill in the art that many moreembodiments and implementations are possible that are within the scopeof this invention.

1. A system for detecting either or both underflow and overflow of a circular buffer capable of holding n entries, wherein n is an integer of two or more, each entry including a tag portion, the system comprising: a first counter for circularly counting through m values, wherein m is an integer less than n and is not evenly divisible into n; and first logic for performing a read operation by (1) reading an entry from the buffer, (2) comparing the tag portion of the entry with the contents of the counter, (3) either or both (a) signaling an underflow condition if the tag portion of the entry is less than the contents of the counter, and (b) signaling an overflow condition if the tag portion of the entry exceeds the contents of the counter, and (4) otherwise updating the contents of the first counter to reflect the read operation.
 2. The system of claim 1, further comprising: a second counter for circularly counting through m values; and second logic for performing a write operation by (1) forming an entry to be written to the buffer, the tag portion of the entry representative of the contents of the second counter, (2) writing the entry to the buffer, and (3) updating the contents of the second counter to reflect the write operation.
 3. The system of claim 2, wherein the first logic is configured to update the contents of the first counter during a read operation by incrementing it, and the second logic is configured to update the contents of the second counter during a write operation by incrementing it.
 4. The system of claim 2, wherein the first logic is configured to update the contents of the first counter during a read wherein the first logic is configured to update the contents of the first counter during a read operation by decrementing it, and the second logic is configured to update the contents of the second counter during a write operation by decrementing it.
 5. A method of detecting either or both underflow and overflow of a circular buffer capable of holding n entries, wherein n is an integer of two or more, each entry including a tag portion, the method comprising performing a read operation by: reading an entry from the buffer; comparing the tag portion of the entry with the contents of a first counter configured to circularly count through m values, where m is an integer less than n and not evenly divisible into n; either or both (a) signaling an underflow condition if the tag portion of the entry is less than the contents of the first counter, and (b) signaling an overflow condition if the tag portion of the entry is greater than the contents of the first counter; and updating the contents of the first counter if the contents of the first counter equal the tag portion of the entry.
 6. The method of claim 5, further comprising performing a write operation by: forming an entry to be written to the buffer, the tag portion of the entry representative of the contents of a second counter configured to circularly count through m values; writing the entry to the buffer; and updating the contents of the second counter.
 7. The method of claim 6, wherein the step of updating the contents of the first counter during a read operation comprises incrementing it, and the step of updating the contents of the second counter during a write operation comprises incrementing it.
 8. The method of claim 6, wherein the step of updating the contents of the first counter during a read operation comprises decrementing it, and the step of updating the contents of the second counter during a write operation comprises decrementing it.
 9. The method of claim 5, wherein the circular buffer is a FIFO buffer. 